﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Reflection.Emit;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace WHUIdemo.Forms.PosDemoPageFrm
{
    public partial class MemberFrm : Form
    {
        public MemberFrm()
        {
            InitializeComponent();
        }
         public BindingList<VIPMember> VipMemberList = new BindingList<VIPMember>();

        public BindingList<VIPMember>tempVip=new BindingList<VIPMember>();

        private void MemberFrm_Load(object sender, EventArgs e)
        {
             
            for (int i = 0; i < 10; i++)
            {
                VIPMember vip=new VIPMember();
                vip.MemberID = "1000" + i.ToString();
                vip.MemberName = "会员" + i.ToString();
                vip.MemberCardID = "88" + i.ToString();
                vip.MemberPhone = "1378150" + i.ToString() ;
                vip.MemberDiscount= "会员价";
                vip.MemberType = "普通会员";
                VipMemberList.Add(vip);

            }

            whDataGridView1.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.Fill;
            //whDataGridView1.AutoSizeRowsMode= DataGridViewAutoSizeRowsMode.DisplayedCells;
            //whDataGridView1.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.EnableResizing;
           
            whDataGridView1.AutoSizeRowsMode = DataGridViewAutoSizeRowsMode.None;
            //whDataGridView1.RowTemplate.Height = 100;


        }

        private void whDataGridView1_Resize(object sender, EventArgs e)
        {
            whDataGridView1.DataSource = null;
            //whDataGridView1.Rows.Clear();
           whDataGridView1.AutoGenerateColumns= false;
 
            whDataGridView1.RowTemplate.Height = (whDataGridView1.Height  -whDataGridView1.ColumnHeadersHeight) / 11;
          whDataGridView1.DataSource = VipMemberList;
            whDataGridView1.Refresh();       
         }

        private void whDataGridView1_CellContentClick(object sender, DataGridViewCellEventArgs e)
        {
         
           
        }

        private void whDataGridView1_RowEnter(object sender, DataGridViewCellEventArgs e)
        {   if (whDataGridView1.SelectedCells.Count>0)
            {
            int selectindex = whDataGridView1.SelectedCells[0].RowIndex;
            label1.Text="姓名："+ VipMemberList[selectindex].MemberName;
                label2.Text = "卡号：" + VipMemberList[selectindex].MemberCardID;
                label3.Text = "手机号：" + VipMemberList[selectindex].MemberPhone;

                label4.Text = "类别：" + VipMemberList[selectindex].MemberType;
                label5.Text = "优惠信息：" + VipMemberList[selectindex].MemberDiscount;
                label7.Text = "积分：0.00";

                label8.Text = "余额：0.00";

            }

        }
    }




    public class VIPMember {
    
     public string MemberID { get; set; }
        public string MemberName { get; set; }
        public string MemberType { get; set; }
        public string MemberPhone { get; set; }
        public string MemberCardID { get; set; }
        public string MemberDiscount{ get; set; }

   

    }




}
